Creating a New Sector
Creating new sectors in Macro involves two main steps:
- Choose a unique name for the new sector.
- Add the new sector to the
MacroEnergy.jl
file.
The Commodity
Type
If you're not familiar with Julia's type system, we recommend this section of the Julia documentation. In particular, for more information on abstract types, see the Abstract Types section.
In Macro, the Commodity
type is an abstract type which defines a generic type used to represent all commodities in the package. Each specific commodity (e.g., electricity, hydrogen) is then defined as a subtype of Commodity:
MacroEnergy.jl
## Commodity types
abstract type Commodity end
abstract type Electricity <: Commodity end
abstract type Hydrogen <: Commodity end
abstract type NaturalGas <: Commodity end
Here, the operator <:
means is-a-subtype-of. In this example, both Electricity
and Hydrogen
are subtypes of the abstract Commodity
type.
This diagram shows the type hierarchy in Macro where:
Commodity
is the base (abstract) typeElectricity
,Hydrogen
, andNaturalGas
are all subtypes ofCommodity
- The arrows show the "is-a-subtype-of" relationship using the
<:
operator
Adding a new sector to Macro
To define a new sector in Macro, simply add a new line in the MacroEnergy.jl
file:
MacroEnergy.jl
# ... existing code ...
abstract type MyNewSector <: Commodity end
# ... existing code ...
This line defines MyNewSector
as a new subtype of Commodity
. Once added, you can create nodes and edges in the energy system graph that correspond to this new sector.
Next Steps
After defining the new commodity type, you can proceed to build new assets and transformation processes using nodes and edges associated with any Commodity
type defined in Macro.
Creating a New Asset: Step-by-step instructions for developing a new asset.
Creating a New Example Case: A guide to developing a new example case.